To start off, the histogram below illustrates the distribution of SDG 12 scores across different regions.
goal_12_histogram <- ggplot(sdr_data, aes(x = goal_12_score, fill=regions_used_for_the_sdr)) +
geom_histogram() +
theme_minimal() +
scale_fill_viridis_d(option = "plasma") +
labs(title = "Distributions of SDG 12 Scores",
x = "SDG 12 Score",
y = "Number of Countries",
fill = "Regions")
ggplotly(goal_12_histogram)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 27 rows containing non-finite outside the scale range
## (`stat_bin()`).
The histogram illustrates the distribution of SDG 12 scores across different regions, with the x-axis representing the SDG 12 scores and the y-axis indicating the number of countries within each score range. Each color on the histogram denotes a different region.
Let’s look into regions further through a map.
mytext <- paste(
"Country: ", sdr_data_world_joined$country,"<br/>",
"Goal 12 Score: ", round(sdr_data_world_joined$goal_12_score, 2),
sep="") %>%
lapply(htmltools::HTML)
leaflet(sdr_data_world_joined) %>%
addTiles() %>%
setView( lat=10, lng=0 , zoom=2) %>%
addPolygons(stroke = FALSE, fillOpacity = 0.5, smoothFactor = 0.5, color = ~colorQuantile("PuOr", goal_12_score)(goal_12_score), label = mytext)
Color indication for SDG 12 Scores
I chose to visualize the data this way because it is easier to have an overall view of how each region is doing. From here, we can zoom into the scores for specific countries.
Many African and Asian countries have high SDG 12 scores (darker purple), such as Mozambique and Tanzania. This may be due to factors such as lower usage of conventional vehicles such as trains, cars, and other vehicles that run on fossil fuels. Another reason may be that certain countries have a more proper waste management/disposal.
On the other hand, countries like the United States, Spain, and Canada have lower scores. Their scores ranging from 50% to 70%. This indicates a potential need for greater changes in their consumption policies and regulations, as well as a reduction in their material footprint.
Let’s dig deeper and look into a specific indicator under SDG 12.
sdr_data_normalized_scores <- sdr_data %>%
select(country, contains("normalized_score"))
sdr_data_normalized_scores_longer <- sdr_data_normalized_scores %>%
pivot_longer(cols = !country)
missing_data_by_country <- sdr_data_normalized_scores_longer %>%
group_by(country) %>%
miss_var_summary() %>%
arrange(desc(pct_miss))
missing_data_by_country
## # A tibble: 412 × 4
## # Groups: country [206]
## country variable n_miss pct_miss
## <chr> <chr> <int> <num>
## 1 Andorra value 98 100
## 2 Antigua and Barbuda value 98 100
## 3 Dominica value 98 100
## 4 Eritrea value 98 100
## 5 Micronesia, Fed. Sts. value 98 100
## 6 Guinea-Bissau value 98 100
## 7 Equatorial Guinea value 98 100
## 8 Grenada value 98 100
## 9 Kiribati value 98 100
## 10 St. Kitts and Nevis value 98 100
## # ℹ 402 more rows
completely_na_countries <- missing_data_by_country$country[missing_data_by_country$pct_miss == 100]
completely_na_countries
## [1] "Andorra" "Antigua and Barbuda"
## [3] "Dominica" "Eritrea"
## [5] "Micronesia, Fed. Sts." "Guinea-Bissau"
## [7] "Equatorial Guinea" "Grenada"
## [9] "Kiribati" "St. Kitts and Nevis"
## [11] "Libya" "St. Lucia"
## [13] "Liechtenstein" "Monaco"
## [15] "Marshall Islands" "Nauru"
## [17] "Palau" "Korea, Dem. Rep."
## [19] "Solomon Islands" "San Marino"
## [21] "Seychelles" "Timor-Leste"
## [23] "Tonga" "Tuvalu"
## [25] "St. Vincent and the Grenadines" "Vanuatu"
## [27] "Samoa"
sdr_data_normalized_scores_no_na_countries <- sdr_data_normalized_scores %>%
filter(!country %in% completely_na_countries)
sdr_data_normalized_scores_less_na <- sdr_data_normalized_scores_no_na_countries %>%
select(where(~ sum(is.na(.))/length(.) <= 0.2))
sdr_data_imputed <- missRanger(sdr_data_normalized_scores_less_na)
sdr_data_imputed <- sdr_data_imputed %>%
remove_rownames %>%
column_to_rownames(var="country")
bottom_15_countries <- sdr_data_normalized_scores_no_na_countries %>%
arrange(normalized_score_sdg12_ewaste) %>%
slice(1:15)
bottom_bar <- ggplot(bottom_15_countries, aes(x = reorder(country, normalized_score_sdg12_ewaste), y = normalized_score_sdg12_ewaste)) +
theme_minimal() +
geom_col(fill = "#800080") +
labs(title = "15 Lowest-Ranked Countries in SDG 12: E-Waste Management", x = "Country", y = "E-waste Management Score") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
ggplotly(bottom_bar)
The visualization above highlights the 15 countries with the lowest scores in E-waste management, a key aspect of Sustainable Development Goal (SDG) 12. These countries struggle with effective E-waste management due to factors such as:
Lack of regulations for garbage disposal
Mass production of electronics, leading to rapid disposal of older devices
The electronic waste is estimated based on figures for domestic production, imports and exports of electronic products, as well as product lifespan data. More info Notably, many of the countries in the bottom 15 are known for their urban areas, which may contribute to the generation of electrical waste.
These observations highlight the need for improved E-waste management practices in these countries to achieve the goals of SDG 12.
What other factors can be addressed to enhance electronic waste management capabilities?
Let’s look at some of the most important variables in predicting E-waste management scores.
rf_ewaste <- randomForest(normalized_score_sdg12_ewaste ~ .,
data = sdr_data_imputed,
importance = TRUE)
rf_ewaste
##
## Call:
## randomForest(formula = normalized_score_sdg12_ewaste ~ ., data = sdr_data_imputed, importance = TRUE)
## Type of random forest: regression
## Number of trees: 500
## No. of variables tried at each split: 27
##
## Mean of squared residuals: 54.37681
## % Var explained: 93.31
importance_df <- as.data.frame(rf_ewaste$importance)
importance_df_top_10 <- importance_df %>%
rownames_to_column(var = "variable") %>%
slice_max(n = 10, order_by = `%IncMSE`)
ggplot(importance_df_top_10, aes(x = `%IncMSE`, y = reorder(variable, `%IncMSE`))) +
geom_bar(stat = "identity", fill = "steelblue", color = "black") +
theme_minimal() +
labs(title = "Most Important Variables in Predicting Electronic Waste",
subtitle = "Top 10",
y = "SDG Indicator",
x = "Feature Importance (% Increase in Mean Squared Error)")
By understanding and addressing the carbon footprint of imported goods, especially in the context of electronics, countries can make more informed decisions to improve their overall sustainability and develop better e-waste management strategies. This allows them to move forward towards taking climate action.